﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DNX.Framework
{
    public static class IEnumerableExtensions
    {
        public static void ForEach<T>(this IEnumerable<T> enumerable, Action<T> action)
        {
            if (enumerable.IsNullOrEmpty())
                return;
            foreach (var item in enumerable)
                action(item);
        }

        public static bool IsEmpty<T>(this IEnumerable<T> enumerable)
        {
            return !enumerable.Any();
        }

        public static bool IsNullOrEmpty<T>(this IEnumerable<T> enumerable)
        {
            return enumerable == null || enumerable.IsEmpty();
        }
    }
}
